package com.showsu.editor.utils;

import java.util.Random;

/**
 * @Author: William
 * @Description: 验证码生成器
 * @Date: Created in 11:33 上午 2023/3/21
 * @Modified By:
 */
public class CodeGenerator {

    public static int ranRan(int m, int n) {
        Random random = new Random();
        return random.nextInt(n - m) + m;
    }

    /**
     * 生成6位的校验码
     * @return
     */
    public static int generate6L(){
        return ranRan(100001, 1000000);
    }

    /**
     * 生成4位的校验码
     * @return
     */
    public static int generate4L(){
        return ranRan(1001, 10000);
    }
}
